//
//  CPBaseNavigationController.swift
//  cockpit
//
//  Created by Haijun Si on 2020/7/7.
//  Copyright © 2020 chenganrt. All rights reserved.
//

import UIKit

class CPBaseNavigationController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        setupNavBarAppearence()
    }
    
    func setupNavBarAppearence() {
        // 设置导航栏默认的背景颜色
//        WRNavigationBar.defaultNavBarBarTintColor = CPRGBColor(red: 245, green: 245, blue: 245)
        WRNavigationBar.defaultNavBarBarTintColor = CPColor_White
        // 设置导航栏所有按钮的颜色
        WRNavigationBar.defaultNavBarTintColor = CPColor_MainColor
        WRNavigationBar.defaultNavBarTitleColor = .black
        // 如果需要设置导航栏底部分割线隐藏，可以在这里统一设置
        WRNavigationBar.defaultShadowImageHidden = true
//        WRNavigationBar.defaultNavBarBackgroundImage
        
    }
}


extension CPBaseNavigationController  {
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        if children.count > 0 {
            viewController.hidesBottomBarWhenPushed = true
        }
        super.pushViewController(viewController, animated: animated)
    }
}

